@extends('backend.layouts.app')

@section('title', $title =  '网站平台分数互转' )

@section('breadcrumb')
    <a href="">系统设置</a>
    <a href="">网站管理</a>
    <a href="">{{$title}}</a>
@endsection

@section('content')
    <div class="layui-main">

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>{{ $title }}</legend>
        </fieldset>
        @if(\Auth::user()->type!=2)
            <form class="layui-form layui-form-pane" method="GET"
                  action="{{ route('site.plat_mutual_transfer') }}">
                {{ csrf_field() }}
                <div class="layui-inline">
                    <label class="layui-form-label">网站选择</label>
                    <div class="layui-input-inline">
                        <select name="site_id" lay-verify="required" lay-search="">
                            <option value="">直接选择或搜索选择</option>
                            @foreach($sites as $value)
                                <option value="{{$value->id}}">{{$value->username}}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                <button class="layui-btn" lay-submit="" lay-filter="demo1">提交</button>
            </form>
        @endif
        @if(isset($site))
            <form class="layui-form layui-form-pane" method="POST"
                  action="{{ route('site.plat_mutual_transfer.store',[$site->id]) }}">
                {{ csrf_field() }}

                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">{{$site->site_name??$site->username}}网站信息</div>
                        <div class="layui-card-body">
                            余额：{{$site->money}}<br>
                            网站代理：{{$site->agent?$site->agent->name:'系统代理'}}<br>
                        </div>
                    </div>

                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                        <legend>平台分数</legend>
                    </fieldset>
                    <div class="layui-form-item" pane="">
                        <label class="layui-form-label">平台</label>

                        @foreach($site->MainGamePlat as $plat)
                            <div class="layui-inline">
                                <label class="layui-form-label">{{$plat->main_game_plat_name}}:</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="" autocomplete="off" value="{{$plat->pivot->score}}"
                                           class="layui-input" disabled>
                                </div>

                                <div class="layui-input-inline">
                                    <input type="text" name="" autocomplete="off" value="{{$plat->pivot->rate}}"
                                           class="layui-input" disabled>
                                </div>
                            </div>


                        @endforeach

                    </div>
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                        <legend>加分</legend>
                    </fieldset>

                    <div class="layui-inline">
                        <div class="layui-inline">
                            <label class="layui-form-label">转出平台</label>
                            <div class="layui-input-inline">
                                <select name="to_plat_id" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                    @foreach($site->MainGamePlat as $plat)
                                        <option value="{{$plat->id}}">{{$plat->main_game_plat_name}}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">转入平台</label>
                            <div class="layui-input-inline">
                                <select name="in_plat_id" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                    @foreach($site->MainGamePlat as $plat)
                                        <option value="{{$plat->id}}">{{$plat->main_game_plat_name}}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">转换分数:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="score" lay-verify="required|number" autocomplete="off"
                                       value=""
                                       placeholder="请输入转换分数"
                                       class="layui-input">
                            </div>
                        </div>
                    </div>

                </div>

                <div class="layui-form-item  layui-container" style="padding-top: 50px">
                    <button class="layui-btn" lay-submit="" lay-filter="demo1">提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </form>
        @endif
    </div>
@endsection

@section('scripts')

@endsection